﻿#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int main()
{
    int n;
    scanf("%d", &n);
    char arr[800][800];
    int y = 3 * pow(2, n - 1) - 1;
    //打印第一个三角形
    arr[0][y] = '*';
    arr[1][y - 1] = '*';
    arr[1][y + 1] = '*';
    arr[2][y - 2] = '*';
    arr[2][y] = '*';
    arr[2][y + 2] = '*';
    //第一次循环将小三角形赋给第一个三角形左右下角
    //第二次循环将三个三角形组成的三角形赋给三个三角形组成的三角形左右下角
    for (int i = 1; i < n; i++)
    {
        int range = 3 * pow(2, i - 1) - 1;
        for (int x1 = 0; x1 <= range; x1++)
        {
            for (int y1 = y - range; y1 <= y + range; y1++)
            {
                arr[x1 + range + 1][y1 - range - 1] = arr[x1][y1];
            }
        }
        for (int x1 = 0; x1 <= range; x1++)
        {
            for (int y1 = y - range; y1 <= y + range; y1++)
            {
                arr[x1 + range + 1][y1 + range + 1] = arr[x1][y1];
            }
        }
    }
    //打印
    for (int i = 0; i <= 3 * pow(2, n - 1) - 1; i++)
    {
        for (int j = 0; j <= 3 * pow(2, n) - 2; j++)
        {
            if (arr[i][j] == '*')
            {
                printf("%c", arr[i][j]);
            }
            else {
                printf(" ");
            }
        }
        printf("\n");
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < y; j++)
        {
            printf(" ");
        }
        printf("*\n");
    }
    return 0;
}